using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using EPiServer;
using EPiServer.Core;
using EPiServer.UI;
using EPiServer.UI.WebControls;
using EPiServer.Configuration;

namespace EPiServer.Research.TinyMCEAdapter
{
    public partial class WrapServerObjectBrowser : SystemPageBase
    {
        protected override void OnInit(EventArgs e)
        {
            if (!EPiServer.Security.PrincipalInfo.HasEditAccess)
            {
                Response.Write("You do not have access rights to this page");
                Response.End();
            }
           
            if (!string.IsNullOrEmpty(Request["type"]))
            {

                string type = Request["type"];
                if (type.ToLower() != "file")
                {
               
                    this.TabSelectPage.Visible = false;
                }
                else
                {
                    this.TabSelectFile.Visible = false;
                } 
            }

          

        }

        protected override void OnPreInit(EventArgs e)
        {  
            if (!string.IsNullOrEmpty(Request["pageID"]))
            {
                string id = Request["pageID"];
                string url = DataFactory.Instance.GetPage(new PageReference(Convert.ToInt32(id))).LinkURL;
                Response.Write(url);
                Response.End();
            }
            base.OnPreInit(e);
        }
       
       
    }
}
